class CreateProjects < ActiveRecord::Migration
  def self.up
    create_table :projects do |t|
      t.column :name, :string
    end
    add_column :deliverables, :project_id, :integer

    project = Project.new :name => "N/A"
    project.save

    Deliverable.find(:all).each do |deliverable|
      if deliverable.project == nil 
        deliverable.project = project
        deliverable.save
      end
    end

  end

  def self.down
    drop_table :projects
    remove_column :deliverables, :project_id
  end
end
